import http from '@/libs/http';
import { IResponse, IUserInfo } from '@/types';

export async function loginService(userInfo: IUserInfo) {
  // return (await http.post('/api/user.login', userInfo)) as IResponse; 写法1 断言
  return await http.post<unknown, IResponse>('/api/user/login', userInfo); //写法2 泛型
}

export async function registerService(userInfo: IUserInfo) {
  return await http.post<unknown, IResponse>('/api/user/register', userInfo);
}

export async function checkLoginService() {
  return await http.post<unknown, IResponse>('/api/user/check_login');
}
